﻿
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace Simple.Example.Moq.Test
{
	[TestClass]
	public class CustomerServiceTest
	{
		[TestMethod]
		public void GetCustomer_ValidId()
		{
			// Arrange
			const int CUSTOMER_ID = 1;
			const string FNAME = "John";
			const string LNAME = "Doe";

			var repository = new Mock<ICustomerRepository>();

			repository
				 .Setup( m => m.GetCustomer( CUSTOMER_ID ) )
				 .Returns( new Customer
				 {
					 FirstName = FNAME,
					 LastName = LNAME
				 } );


			var business = new Mock<ICustomerBusiness>();

			business
				.Setup( b => b.ValidateId( 0 ) )
				.Returns( true );

			var service = new CustomerService( repository.Object );

			// Act
			var customer = service.GetCustomer( CUSTOMER_ID );

			// Assert  
			
			//Assert.IsTrue( customer != null );
			//Assert.IsTrue( customer.FirstName == FNAME );
			//Assert.IsTrue( customer.LastName == LNAME );

			int seg = 14400000;
			Assert.IsTrue( seg > 0 );
			repository.VerifyAll();
		}

		[TestMethod]
		public void TesteFakes()
		{
				
		}
	}
}
